package com.headfirst.CreateMode.factory.factorymethod;

import java.util.ArrayList;
import java.util.List;

/**
 * @author sunhongguang
 * @create 2022-01-23-21:24
 */
public abstract class Pizza {

    /**
     * 名称
     */
    private String name;
    /**
     * 面团类型
     */
    private String dough;

    /**
     * 酱料类型
     */
    private String sauce;

    /**
     * 一套佐料
     */
    List<String> toppings = new ArrayList<>();

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDough() {
        return dough;
    }

    public void setDough(String dough) {
        this.dough = dough;
    }

    public String getSauce() {
        return sauce;
    }

    public void setSauce(String sauce) {
        this.sauce = sauce;
    }

    public List<String> getToppings() {
        return toppings;
    }

    public void setToppings(List<String> toppings) {
        this.toppings = toppings;
    }

    public void prepare() {
        System.out.println("Prepare " + getName());
        System.out.println("Tossing dough...");
        System.out.println("Adding sauce...");
        System.out.println("Adding toppings: ");
        for (String topping : toppings) {
            System.out.println("   " + topping);
        }
    }

    public void bake() {
        System.out.println("Bake for 25 minutes at 350");
    }

    public void cut() {
        System.out.println("Cut the pizza into diagonal slices");
    }

    public void box() {
        System.out.println("Place pizza in official PizzaStore box");
    }

    public String toString(){
        StringBuffer display = new StringBuffer();
        display.append("---- "+name+" ----\n");
        display.append(dough+"\n");
        display.append(sauce+"\n");
        for(String topping : toppings){
            display.append(topping+"\t");
        }
        return display.toString();
    }
}
